class P324 {

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

	
	public static void main(String[] args) {
		int[][] array = new int[367][10];
		int[] array1 = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
		array[1] = array1;
		int[] array2 = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 };
		array[2] = array2;
		int[] array3 = { 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 };
		array[3] = array3;
		int[] array4 = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 };
		array[4] = array4;
		int[] array5 = { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
		array[5] = array5;
		int[] array6 = { 1, 0, 1, 0, 0, 0, 0, 1, 0, 0 };
		array[6] = array6;
		int[] array7 = { 2, 0, 0, 0, 1, 1, 0, 0, 0, 0 };
		array[7] = array7;
		int[] array8 = { 2, 0, 1, 1, 1, 0, 0, 0, 0, 0 };
		array[8] = array8;
		int[] array9 = { 1, 0, 1, 1, 0, 0, 1, 0, 2, 0 };
		array[9] = array9;
		int[] array10 = { 2, 0, 1, 1, 0, 0, 1, 0, 2, 0 };
		array[10] = array10;
		int[] array11 = { 2, 1, 0, 1, 0, 0, 1, 0, 1, 2 };
		array[11] = array11;
		int[] array12 = { 4, 1, 0, 0, 1, 0, 1, 1, 0, 1 };
		array[12] = array12;
		int[] array13 = { 4, 0, 3, 0, 0, 0, 1, 1, 1, 0 };
		array[13] = array13;
		int[] array14 = { 2, 2, 2, 0, 0, 0, 0, 2, 2, 1 };
		array[14] = array14;
		int[] array15 = { 4, 1, 0, 2, 1, 0, 2, 2, 1, 0 };
		array[15] = array15;
		int[] array16 = { 4, 0, 3, 0, 0, 0, 0, 1, 4, 2 };
		array[16] = array16;
		int[] array17 = { 4, 0, 1, 1, 1, 2, 2, 1, 2, 1 };
		array[17] = array17;
		int[] array18 = { 5, 0, 2, 2, 1, 1, 1, 3, 1, 0 };
		array[18] = array18;
		int[] array19 = { 6, 3, 2, 1, 2, 1, 1, 0, 2, 0 };
		array[19] = array19;
		int[] array20 = { 7, 1, 3, 1, 2, 0, 2, 1, 1, 1 };
		array[20] = array20;
		int[] array21 = { 7, 3, 1, 0, 3, 1, 0, 2, 0, 3 };
		array[21] = array21;
		int[] array22 = { 8, 2, 2, 0, 1, 0, 2, 6, 1, 0 };
		array[22] = array22;
		int[] array23 = { 5, 1, 2, 1, 2, 2, 3, 2, 4, 1 };
		array[23] = array23;
		int[] array24 = { 6, 1, 2, 5, 4, 0, 2, 1, 1, 2 };
		array[24] = array24;
		int[] array25 = { 9, 4, 1, 3, 2, 3, 0, 0, 2, 2 };
		array[25] = array25;
		int[] array26 = { 8, 3, 2, 2, 3, 3, 4, 0, 1, 1 };
		array[26] = array26;
		int[] array27 = { 9, 3, 1, 1, 2, 2, 3, 1, 6, 1 };
		array[27] = array27;
		int[] array28 = { 10, 4, 0, 3, 4, 2, 2, 1, 4, 0 };
		array[28] = array28;
		int[] array29 = { 7, 4, 0, 3, 3, 2, 3, 3, 2, 4 };
		array[29] = array29;
		int[] array30 = { 9, 3, 4, 2, 1, 4, 3, 0, 5, 2 };
		array[30] = array30;
		int[] array31 = { 7, 2, 7, 1, 1, 3, 2, 4, 6, 1 };
		array[31] = array31;
		int[] array32 = { 10, 5, 3, 7, 0, 1, 5, 1, 2, 2 };
		array[32] = array32;
		int[] array33 = { 8, 7, 1, 2, 3, 2, 3, 1, 8, 2 };
		array[33] = array33;
		int[] array34 = { 11, 2, 4, 3, 4, 2, 4, 2, 2, 5 };
		array[34] = array34;
		int[] array35 = { 9, 4, 3, 7, 3, 2, 7, 2, 1, 3 };
		array[35] = array35;
		int[] array36 = { 10, 4, 3, 4, 3, 2, 2, 4, 3, 7 };
		array[36] = array36;
		int[] array37 = { 12, 4, 3, 5, 3, 5, 3, 3, 2, 4 };
		array[37] = array37;
		int[] array38 = { 16, 7, 7, 1, 3, 1, 5, 4, 0, 1 };
		array[38] = array38;
		int[] array39 = { 12, 3, 4, 5, 3, 2, 2, 4, 7, 5 };
		array[39] = array39;
		int[] array40 = { 9, 6, 5, 3, 4, 5, 3, 4, 4, 5 };
		array[40] = array40;
		int[] array41 = { 15, 6, 4, 5, 3, 6, 6, 3, 2, 0 };
		array[41] = array41;
		int[] array42 = { 13, 6, 3, 3, 6, 5, 5, 3, 4, 4 };
		array[42] = array42;
		int[] array43 = { 13, 4, 4, 9, 2, 7, 6, 4, 2, 2 };
		array[43] = array43;
		int[] array44 = { 12, 6, 4, 3, 5, 5, 5, 4, 9, 2 };
		array[44] = array44;
		int[] array45 = { 13, 7, 4, 5, 4, 5, 8, 4, 3, 4 };
		array[45] = array45;
		int[] array46 = { 16, 4, 8, 1, 3, 8, 4, 1, 7, 6 };
		array[46] = array46;
		int[] array47 = { 11, 10, 6, 5, 3, 5, 7, 2, 4, 7 };
		array[47] = array47;
		int[] array48 = { 14, 4, 6, 7, 4, 6, 6, 8, 4, 3 };
		array[48] = array48;
		int[] array49 = { 14, 5, 10, 6, 3, 5, 6, 5, 7, 2 };
		array[49] = array49;
		int[] array50 = { 19, 7, 3, 6, 7, 2, 9, 5, 5, 2 };
		array[50] = array50;
		int[] array51 = { 18, 10, 10, 6, 3, 4, 5, 3, 5, 3 };
		array[51] = array51;
		int[] array52 = { 18, 3, 3, 4, 5, 7, 8, 8, 9, 3 };
		array[52] = array52;
		int[] array53 = { 17, 2, 6, 9, 7, 3, 7, 5, 8, 6 };
		array[53] = array53;
		int[] array54 = { 18, 5, 9, 8, 6, 3, 3, 7, 9, 4 };
		array[54] = array54;
		int[] array55 = { 18, 5, 6, 5, 6, 11, 9, 4, 4, 6 };
		array[55] = array55;
		int[] array56 = { 17, 4, 1, 3, 13, 5, 6, 9, 11, 6 };
		array[56] = array56;
		int[] array57 = { 20, 7, 9, 4, 8, 6, 7, 4, 7, 5 };
		array[57] = array57;
		int[] array58 = { 17, 10, 10, 5, 8, 5, 4, 4, 10, 6 };
		array[58] = array58;
		int[] array59 = { 19, 6, 6, 8, 7, 5, 6, 7, 9, 8 };
		array[59] = array59;
		int[] array60 = { 19, 8, 9, 8, 10, 3, 8, 7, 4, 6 };
		array[60] = array60;
		int[] array61 = { 26, 3, 10, 4, 4, 7, 6, 6, 11, 7 };
		array[61] = array61;
		int[] array62 = { 20, 8, 13, 8, 4, 6, 6, 8, 7, 6 };
		array[62] = array62;
		int[] array63 = { 21, 9, 8, 5, 8, 4, 11, 8, 7, 7 };
		array[63] = array63;
		int[] array64 = { 20, 12, 6, 9, 10, 7, 6, 3, 12, 5 };
		array[64] = array64;
		int[] array65 = { 20, 5, 11, 7, 8, 10, 8, 9, 7, 6 };
		array[65] = array65;
		int[] array66 = { 23, 5, 8, 7, 16, 3, 8, 8, 9, 6 };
		array[66] = array66;
		int[] array67 = { 22, 8, 8, 6, 10, 7, 11, 6, 9, 8 };
		array[67] = array67;
		int[] array68 = { 25, 11, 8, 9, 7, 8, 6, 8, 7, 8 };
		array[68] = array68;
		int[] array69 = { 21, 9, 14, 10, 13, 5, 4, 8, 8, 7 };
		array[69] = array69;
		int[] array70 = { 20, 7, 7, 5, 6, 10, 11, 9, 14, 12 };
		array[70] = array70;
		int[] array71 = { 25, 6, 8, 7, 5, 7, 11, 10, 18, 5 };
		array[71] = array71;
		int[] array72 = { 23, 6, 10, 8, 10, 3, 10, 12, 15, 7 };
		array[72] = array72;
		int[] array73 = { 35, 16, 8, 6, 7, 7, 6, 7, 9, 5 };
		array[73] = array73;
		int[] array74 = { 23, 13, 14, 10, 7, 13, 5, 7, 9, 7 };
		array[74] = array74;
		int[] array75 = { 25, 9, 9, 7, 13, 9, 9, 9, 10, 10 };
		array[75] = array75;
		int[] array76 = { 24, 7, 12, 11, 11, 10, 8, 9, 8, 12 };
		array[76] = array76;
		int[] array77 = { 32, 7, 10, 7, 11, 6, 9, 7, 18, 7 };
		array[77] = array77;
		int[] array78 = { 25, 11, 16, 9, 10, 9, 8, 10, 12, 6 };
		array[78] = array78;
		int[] array79 = { 29, 15, 8, 10, 4, 7, 11, 10, 14, 9 };
		array[79] = array79;
		int[] array80 = { 27, 8, 12, 8, 13, 14, 10, 9, 13, 5 };
		array[80] = array80;
		int[] array81 = { 27, 9, 9, 8, 13, 13, 8, 14, 8, 12 };
		array[81] = array81;
		int[] array82 = { 28, 13, 5, 15, 16, 1, 11, 11, 10, 13 };
		array[82] = array82;
		int[] array83 = { 30, 10, 9, 10, 10, 12, 12, 12, 8, 12 };
		array[83] = array83;
		int[] array84 = { 27, 15, 12, 13, 8, 8, 13, 9, 12, 10 };
		array[84] = array84;
		int[] array85 = { 36, 13, 14, 8, 15, 13, 9, 7, 5, 9 };
		array[85] = array85;
		int[] array86 = { 28, 8, 17, 10, 14, 13, 11, 13, 8, 9 };
		array[86] = array86;
		int[] array87 = { 27, 14, 16, 13, 10, 11, 7, 17, 8, 10 };
		array[87] = array87;
		int[] array88 = { 28, 14, 12, 8, 18, 10, 12, 2, 18, 13 };
		array[88] = array88;
		int[] array89 = { 34, 12, 9, 12, 6, 10, 15, 11, 10, 18 };
		array[89] = array89;
		int[] array90 = { 28, 11, 10, 10, 13, 12, 15, 12, 14, 14 };
		array[90] = array90;
		int[] array91 = { 29, 12, 8, 6, 12, 17, 17, 19, 9, 12 };
		array[91] = array91;
		int[] array92 = { 29, 13, 8, 18, 17, 17, 8, 15, 11, 7 };
		array[92] = array92;
		int[] array93 = { 32, 16, 17, 12, 12, 14, 11, 12, 12, 7 };
		array[93] = array93;
		int[] array94 = { 37, 11, 11, 12, 12, 15, 16, 10, 16, 7 };
		array[94] = array94;
		int[] array95 = { 32, 8, 19, 15, 12, 12, 11, 15, 10, 15 };
		array[95] = array95;
		int[] array96 = { 36, 9, 7, 9, 16, 11, 11, 15, 16, 20 };
		array[96] = array96;
		int[] array97 = { 26, 17, 13, 12, 11, 11, 13, 16, 17, 16 };
		array[97] = array97;
		int[] array98 = { 35, 6, 16, 10, 16, 9, 14, 19, 16, 13 };
		array[98] = array98;
		int[] array99 = { 28, 15, 19, 10, 10, 14, 19, 7, 14, 20 };
		array[99] = array99;
		int[] array100 = { 30, 15, 19, 10, 10, 14, 19, 7, 14, 20 };
		array[100] = array100;
		int[] array101 = { 35, 10, 14, 18, 14, 13, 14, 12, 12, 18 };
		array[101] = array101;
		int[] array102 = { 37, 12, 9, 12, 17, 27, 16, 6, 11, 15 };
		array[102] = array102;
		int[] array103 = { 36, 16, 17, 11, 18, 15, 11, 9, 17, 14 };
		array[103] = array103;
		int[] array104 = { 33, 13, 13, 12, 16, 14, 11, 25, 18, 12 };
		array[104] = array104;
		int[] array105 = { 45, 11, 14, 16, 11, 11, 15, 15, 12, 19 };
		array[105] = array105;
		int[] array106 = { 36, 11, 19, 20, 22, 8, 15, 15, 18, 7 };
		array[106] = array106;
		int[] array107 = { 42, 19, 15, 22, 11, 17, 14, 10, 11, 12 };
		array[107] = array107;
		int[] array108 = { 41, 17, 12, 16, 17, 15, 12, 12, 19, 14 };
		array[108] = array108;
		int[] array109 = { 39, 13, 21, 23, 17, 10, 8, 15, 17, 14 };
		array[109] = array109;
		int[] array110 = { 38, 18, 23, 13, 18, 13, 12, 19, 13, 12 };
		array[110] = array110;
		int[] array111 = { 39, 17, 12, 15, 18, 20, 19, 19, 10, 12 };
		array[111] = array111;
		int[] array112 = { 38, 10, 17, 17, 15, 15, 14, 22, 18, 17 };
		array[112] = array112;
		int[] array113 = { 35, 26, 24, 14, 15, 14, 17, 15, 12, 13 };
		array[113] = array113;
		int[] array114 = { 47, 19, 16, 19, 19, 18, 11, 8, 18, 12 };
		array[114] = array114;
		int[] array115 = { 51, 19, 18, 18, 12, 21, 9, 12, 13, 16 };
		array[115] = array115;
		int[] array116 = { 44, 23, 14, 18, 8, 16, 19, 13, 17, 19 };
		array[116] = array116;
		int[] array117 = { 47, 15, 14, 14, 25, 11, 21, 14, 14, 18 };
		array[117] = array117;
		int[] array118 = { 40, 13, 24, 21, 17, 14, 17, 13, 23, 13 };
		array[118] = array118;
		int[] array119 = { 42, 16, 11, 18, 29, 17, 12, 20, 19, 13 };
		array[119] = array119;
		int[] array120 = { 45, 19, 15, 16, 15, 21, 16, 11, 21, 20 };
		array[120] = array120;
		int[] array121 = { 47, 15, 20, 17, 18, 11, 18, 23, 16, 16 };
		array[121] = array121;
		int[] array122 = { 52, 14, 19, 15, 24, 18, 15, 18, 13, 15 };
		array[122] = array122;
		int[] array123 = { 42, 25, 24, 16, 15, 16, 21, 14, 17, 16 };
		array[123] = array123;
		int[] array124 = { 53, 25, 12, 11, 22, 20, 21, 17, 11, 16 };
		array[124] = array124;
		int[] array125 = { 47, 16, 11, 20, 16, 24, 16, 19, 25, 16 };
		array[125] = array125;
		int[] array126 = { 52, 19, 15, 22, 16, 15, 13, 25, 21, 14 };
		array[126] = array126;
		int[] array127 = { 54, 14, 17, 13, 11, 14, 25, 29, 14, 23 };
		array[127] = array127;
		int[] array128 = { 50, 11, 21, 21, 18, 25, 21, 18, 16, 15 };
		array[128] = array128;
		int[] array129 = { 48, 22, 23, 17, 20, 14, 23, 14, 19, 18 };
		array[129] = array129;
		int[] array130 = { 51, 14, 21, 14, 23, 24, 16, 20, 15, 22 };
		array[130] = array130;
		int[] array131 = { 46, 16, 15, 17, 21, 19, 26, 21, 21, 20 };
		array[131] = array131;
		int[] array132 = { 54, 20, 19, 14, 19, 15, 27, 18, 17, 22 };
		array[132] = array132;
		int[] array133 = { 61, 22, 17, 15, 12, 21, 17, 21, 26, 15 };
		array[133] = array133;
		int[] array134 = { 56, 21, 19, 22, 27, 12, 15, 14, 22, 21 };
		array[134] = array134;
		int[] array135 = { 57, 20, 18, 23, 25, 21, 19, 19, 19, 10 };
		array[135] = array135;
		int[] array136 = { 53, 24, 24, 16, 19, 22, 18, 19, 25, 13 };
		array[136] = array136;
		int[] array137 = { 49, 19, 28, 23, 13, 16, 18, 25, 28, 16 };
		array[137] = array137;
		int[] array138 = { 54, 19, 20, 15, 21, 16, 23, 22, 29, 18 };
		array[138] = array138;
		int[] array139 = { 57, 24, 14, 15, 14, 19, 27, 16, 18, 35 };
		array[139] = array139;
		int[] array140 = { 60, 24, 11, 17, 20, 20, 21, 24, 22, 23 };
		array[140] = array140;
		int[] array141 = { 53, 26, 24, 15, 18, 18, 16, 29, 22, 23 };
		array[141] = array141;
		int[] array142 = { 56, 20, 20, 12, 22, 14, 20, 29, 28, 25 };
		array[142] = array142;
		int[] array143 = { 53, 28, 13, 26, 23, 26, 25, 17, 20, 17 };
		array[143] = array143;
		int[] array144 = { 58, 16, 18, 26, 20, 19, 16, 27, 23, 27 };
		array[144] = array144;
		int[] array145 = { 57, 27, 21, 16, 25, 21, 19, 20, 18, 28 };
		array[145] = array145;
		int[] array146 = { 57, 22, 27, 16, 18, 22, 20, 20, 26, 27 };
		array[146] = array146;
		int[] array147 = { 57, 27, 28, 20, 20, 23, 19, 21, 23, 19 };
		array[147] = array147;
		int[] array148 = { 50, 25, 23, 26, 23, 26, 21, 24, 26, 15 };
		array[148] = array148;
		int[] array149 = { 52, 10, 25, 28, 23, 25, 21, 22, 29, 26 };
		array[149] = array149;
		int[] array150 = { 51, 20, 25, 19, 30, 32, 21, 22, 21, 22 };
		array[150] = array150;
		int[] array151 = { 60, 27, 26, 24, 21, 21, 19, 20, 27, 20 };
		array[151] = array151;
		int[] array152 = { 61, 24, 20, 30, 21, 29, 23, 26, 19, 15 };
		array[152] = array152;
		int[] array153 = { 62, 31, 20, 28, 21, 19, 29, 15, 19, 26 };
		array[153] = array153;
		int[] array154 = { 68, 22, 18, 18, 24, 22, 28, 22, 28, 22 };
		array[154] = array154;
		int[] array155 = { 57, 24, 24, 30, 27, 20, 27, 24, 16, 25 };
		array[155] = array155;
		int[] array156 = { 62, 22, 24, 24, 18, 24, 28, 24, 22, 28 };
		array[156] = array156;
		int[] array157 = { 54, 22, 28, 21, 26, 30, 23, 30, 23, 22 };
		array[157] = array157;
		int[] array158 = { 60, 25, 19, 31, 22, 20, 23, 24, 29, 28 };
		array[158] = array158;
		int[] array159 = { 59, 28, 30, 26, 20, 22, 29, 16, 30, 23 };
		array[159] = array159;
		int[] array160 = { 63, 29, 24, 27, 24, 19, 22, 23, 21, 33 };
		array[160] = array160;
		int[] array161 = { 66, 23, 26, 19, 30, 25, 15, 26, 28, 29 };
		array[161] = array161;
		int[] array162 = { 70, 26, 29, 19, 25, 20, 17, 25, 24, 35 };
		array[162] = array162;
		int[] array163 = { 68, 24, 27, 23, 22, 23, 30, 26, 19, 30 };
		array[163] = array163;
		int[] array164 = { 63, 28, 37, 24, 22, 21, 26, 27, 28, 18 };
		array[164] = array164;
		int[] array165 = { 68, 25, 22, 26, 32, 33, 23, 22, 21, 24 };
		array[165] = array165;
		int[] array166 = { 66, 26, 24, 25, 20, 23, 35, 27, 23, 29 };
		array[166] = array166;
		int[] array167 = { 70, 42, 23, 19, 29, 24, 22, 25, 22, 25 };
		array[167] = array167;
		int[] array168 = { 63, 28, 25, 21, 29, 29, 35, 27, 27, 19 };
		array[168] = array168;
		int[] array169 = { 70, 28, 24, 20, 29, 28, 25, 26, 31, 24 };
		array[169] = array169;
		int[] array170 = { 68, 29, 31, 20, 22, 32, 31, 26, 20, 28 };
		array[170] = array170;
		int[] array171 = { 66, 32, 25, 21, 22, 30, 27, 26, 34, 27 };
		array[171] = array171;
		int[] array172 = { 73, 27, 20, 32, 22, 30, 23, 31, 27, 27 };
		array[172] = array172;
		int[] array173 = { 66, 22, 40, 30, 26, 24, 29, 28, 21, 28 };
		array[173] = array173;
		int[] array174 = { 67, 23, 34, 30, 22, 30, 40, 22, 30, 18 };
		array[174] = array174;
		int[] array175 = { 72, 27, 23, 32, 28, 18, 48, 19, 27, 25 };
		array[175] = array175;
		int[] array176 = { 75, 34, 22, 33, 24, 28, 21, 22, 36, 26 };
		array[176] = array176;
		int[] array177 = { 70, 19, 30, 38, 27, 29, 20, 30, 38, 22 };
		array[177] = array177;
		int[] array178 = { 60, 32, 31, 24, 21, 25, 34, 29, 35, 34 };
		array[178] = array178;
		int[] array179 = { 74, 26, 28, 32, 34, 18, 32, 34, 24, 26 };
		array[179] = array179;
		int[] array180 = { 75, 30, 16, 39, 27, 26, 32, 20, 29, 36 };
		array[180] = array180;
		int[] array181 = { 66, 27, 31, 36, 31, 22, 35, 20, 34, 30 };
		array[181] = array181;
		int[] array182 = { 79, 31, 23, 26, 36, 22, 30, 29, 27, 31 };
		array[182] = array182;
		int[] array183 = { 69, 25, 37, 37, 32, 21, 25, 37, 24, 30 };
		array[183] = array183;
		int[] array184 = { 75, 18, 40, 27, 36, 29, 28, 27, 33, 26 };
		array[184] = array184;
		int[] array185 = { 81, 33, 31, 21, 33, 34, 29, 29, 27, 23 };
		array[185] = array185;
		int[] array186 = { 83, 27, 31, 32, 26, 25, 34, 27, 33, 25 };
		array[186] = array186;
		int[] array187 = { 67, 28, 37, 33, 27, 32, 31, 36, 25, 30 };
		array[187] = array187;
		int[] array188 = { 73, 32, 22, 24, 39, 33, 27, 34, 23, 41 };
		array[188] = array188;
		int[] array189 = { 72, 34, 28, 32, 31, 26, 36, 30, 29, 32 };
		array[189] = array189;
		int[] array190 = { 74, 27, 35, 29, 40, 36, 33, 24, 26, 28 };
		array[190] = array190;
		int[] array191 = { 82, 23, 32, 29, 27, 30, 35, 27, 39, 31 };
		array[191] = array191;
		int[] array192 = { 80, 27, 26, 35, 32, 39, 29, 27, 24, 38 };
		array[192] = array192;
		int[] array193 = { 70, 30, 32, 42, 24, 35, 18, 41, 31, 36 };
		array[193] = array193;
		int[] array194 = { 87, 24, 40, 28, 31, 34, 21, 24, 38, 35 };
		array[194] = array194;
		int[] array195 = { 81, 29, 33, 31, 30, 39, 36, 24, 23, 38 };
		array[195] = array195;
		int[] array196 = { 80, 37, 36, 28, 26, 23, 36, 36, 34, 30 };
		array[196] = array196;
		int[] array197 = { 76, 21, 29, 39, 34, 31, 40, 37, 32, 30 };
		array[197] = array197;
		int[] array198 = { 80, 33, 41, 29, 35, 38, 30, 25, 32, 28 };
		array[198] = array198;
		int[] array199 = { 71, 53, 36, 30, 25, 29, 42, 24, 34, 29 };
		array[199] = array199;
		int[] array200 = { 76, 26, 54, 41, 35, 25, 29, 35, 23, 31 };
		array[200] = array200;
		int[] array201 = { 80, 46, 43, 36, 33, 24, 31, 32, 29, 24 };
		array[201] = array201;
		int[] array202 = { 82, 34, 39, 40, 39, 27, 32, 35, 24, 28 };
		array[202] = array202;
		int[] array203 = { 91, 27, 36, 30, 29, 42, 31, 31, 27, 38 };
		array[203] = array203;
		int[] array204 = { 78, 32, 43, 37, 33, 33, 31, 36, 28, 34 };
		array[204] = array204;
		int[] array205 = { 71, 33, 46, 38, 27, 45, 36, 21, 35, 35 };
		array[205] = array205;
		int[] array206 = { 78, 32, 36, 30, 33, 37, 39, 30, 37, 37 };
		array[206] = array206;
		int[] array207 = { 74, 38, 34, 35, 25, 26, 43, 32, 41, 44 };
		array[207] = array207;
		int[] array208 = { 82, 31, 37, 30, 32, 33, 41, 32, 40, 36 };
		array[208] = array208;
		int[] array209 = { 85, 36, 38, 36, 31, 33, 38, 32, 34, 33 };
		array[209] = array209;
		int[] array210 = { 83, 38, 40, 28, 34, 37, 39, 38, 33, 29 };
		array[210] = array210;
		int[] array211 = { 89, 41, 35, 32, 39, 25, 44, 38, 28, 30 };
		array[211] = array211;
		int[] array212 = { 85, 33, 37, 30, 39, 36, 35, 44, 34, 30 };
		array[212] = array212;
		int[] array213 = { 95, 41, 31, 23, 33, 36, 53, 45, 28, 21 };
		array[213] = array213;
		int[] array214 = { 82, 26, 35, 40, 35, 40, 45, 32, 33, 40 };
		array[214] = array214;
		int[] array215 = { 81, 38, 35, 36, 32, 30, 48, 30, 38, 42 };
		array[215] = array215;
		int[] array216 = { 102, 37, 27, 38, 32, 33, 41, 30, 36, 37 };
		array[216] = array216;
		int[] array217 = { 78, 37, 41, 41, 40, 33, 37, 42, 39, 27 };
		array[217] = array217;
		int[] array218 = { 85, 42, 39, 38, 26, 32, 42, 34, 34, 45 };
		array[218] = array218;
		int[] array219 = { 96, 46, 34, 36, 23, 45, 42, 31, 36, 31 };
		array[219] = array219;
		int[] array220 = { 85, 29, 39, 36, 37, 48, 38, 45, 30, 35 };
		array[220] = array220;
		int[] array221 = { 90, 40, 28, 33, 37, 45, 40, 40, 35, 36 };
		array[221] = array221;
		int[] array222 = { 93, 38, 35, 26, 43, 54, 38, 25, 41, 34 };
		array[222] = array222;
		int[] array223 = { 85, 34, 40, 46, 43, 36, 36, 25, 50, 34 };
		array[223] = array223;
		int[] array224 = { 81, 35, 24, 46, 47, 45, 41, 42, 31, 39 };
		array[224] = array224;
		int[] array225 = { 95, 30, 37, 38, 47, 32, 41, 36, 38, 40 };
		array[225] = array225;
		int[] array226 = { 87, 40, 43, 43, 29, 44, 34, 38, 35, 43 };
		array[226] = array226;
		int[] array227 = { 102, 35, 32, 48, 48, 35, 33, 33, 31, 41 };
		array[227] = array227;
		int[] array228 = { 99, 40, 43, 39, 38, 39, 37, 50, 28, 28 };
		array[228] = array228;
		int[] array229 = { 96, 39, 37, 43, 45, 35, 33, 41, 47, 27 };
		array[229] = array229;
		int[] array230 = { 89, 38, 43, 39, 45, 51, 30, 31, 38, 41 };
		array[230] = array230;
		int[] array231 = { 89, 50, 45, 46, 44, 35, 40, 28, 39, 32 };
		array[231] = array231;
		int[] array232 = { 98, 39, 41, 33, 33, 39, 41, 37, 44, 45 };
		array[232] = array232;
		int[] array233 = { 93, 42, 48, 41, 46, 31, 41, 32, 44, 34 };
		array[233] = array233;
		int[] array234 = { 88, 46, 30, 48, 32, 37, 52, 32, 37, 53 };
		array[234] = array234;
		int[] array235 = { 93, 47, 41, 40, 42, 45, 36, 46, 37, 30 };
		array[235] = array235;
		int[] array236 = { 94, 43, 48, 43, 43, 41, 35, 39, 39, 35 };
		array[236] = array236;
		int[] array237 = { 91, 37, 45, 37, 38, 42, 42, 44, 44, 42 };
		array[237] = array237;
		int[] array238 = { 100, 43, 35, 44, 38, 40, 40, 47, 41, 36 };
		array[238] = array238;
		int[] array239 = { 96, 40, 40, 44, 48, 50, 36, 32, 45, 36 };
		array[239] = array239;
		int[] array240 = { 99, 40, 43, 28, 32, 48, 49, 37, 42, 51 };
		array[240] = array240;
		int[] array241 = { 104, 33, 34, 38, 51, 44, 41, 44, 41, 41 };
		array[241] = array241;
		int[] array242 = { 100, 33, 33, 45, 36, 43, 38, 54, 56, 36 };
		array[242] = array242;
		int[] array243 = { 94, 46, 35, 30, 42, 45, 42, 50, 49, 43 };
		array[243] = array243;
		int[] array244 = { 102, 40, 52, 33, 39, 56, 40, 35, 39, 43 };
		array[244] = array244;
		int[] array245 = { 103, 40, 38, 39, 38, 44, 46, 46, 42, 45 };
		array[245] = array245;
		int[] array246 = { 97, 51, 49, 48, 45, 32, 44, 39, 45, 33 };
		array[246] = array246;
		int[] array247 = { 101, 57, 41, 37, 44, 40, 44, 39, 38, 45 };
		array[247] = array247;
		int[] array248 = { 100, 42, 42, 44, 47, 50, 36, 38, 44, 45 };
		array[248] = array248;
		int[] array249 = { 105, 49, 54, 41, 33, 42, 43, 42, 31, 51 };
		array[249] = array249;
		int[] array250 = { 103, 43, 56, 40, 34, 39, 32, 53, 53, 40 };
		array[250] = array250;
		int[] array251 = { 105, 51, 33, 47, 43, 47, 43, 42, 47, 37 };
		array[251] = array251;
		int[] array252 = { 104, 44, 49, 43, 45, 47, 44, 44, 43, 35 };
		array[252] = array252;
		int[] array253 = { 99, 41, 43, 46, 54, 34, 48, 47, 35, 53 };
		array[253] = array253;
		int[] array254 = { 114, 44, 40, 45, 53, 40, 41, 38, 49, 39 };
		array[254] = array254;
		int[] array255 = { 110, 42, 54, 46, 42, 47, 50, 39, 40, 35 };
		array[255] = array255;
		int[] array256 = { 104, 44, 50, 39, 42, 46, 53, 51, 47, 31 };
		array[256] = array256;
		int[] array257 = { 120, 44, 43, 45, 42, 42, 40, 42, 52, 40 };
		array[257] = array257;
		int[] array258 = { 120, 62, 42, 37, 47, 48, 39, 35, 39, 43 };
		array[258] = array258;
		int[] array259 = { 103, 65, 45, 45, 43, 37, 44, 46, 45, 42 };
		array[259] = array259;
		int[] array260 = { 112, 45, 48, 64, 36, 45, 42, 36, 45, 44 };
		array[260] = array260;
		int[] array261 = { 116, 39, 33, 50, 41, 52, 50, 52, 38, 48 };
		array[261] = array261;
		int[] array262 = { 104, 59, 44, 38, 51, 33, 43, 50, 50, 50 };
		array[262] = array262;
		int[] array263 = { 106, 53, 47, 40, 53, 37, 47, 57, 40, 44 };
		array[263] = array263;
		int[] array264 = { 121, 49, 49, 46, 43, 55, 43, 45, 36, 40 };
		array[264] = array264;
		int[] array265 = { 110, 45, 41, 53, 44, 50, 45, 49, 47, 45 };
		array[265] = array265;
		int[] array266 = { 115, 49, 46, 38, 40, 45, 56, 47, 45, 51 };
		array[266] = array266;
		int[] array267 = { 109, 56, 44, 51, 56, 41, 50, 45, 36, 46 };
		array[267] = array267;
		int[] array268 = { 108, 44, 49, 45, 56, 46, 52, 47, 40, 49 };
		array[268] = array268;
		int[] array269 = { 115, 45, 58, 45, 47, 50, 40, 38, 43, 58 };
		array[269] = array269;
		int[] array270 = { 103, 50, 51, 51, 47, 49, 59, 37, 46, 48 };
		array[270] = array270;
		int[] array271 = { 117, 37, 55, 37, 48, 66, 46, 41, 47, 50 };
		array[271] = array271;
		int[] array272 = { 105, 57, 50, 53, 51, 51, 44, 37, 47, 51 };
		array[272] = array272;
		int[] array273 = { 133, 54, 43, 53, 62, 38, 43, 40, 42, 41 };
		array[273] = array273;
		int[] array274 = { 128, 48, 39, 50, 59, 51, 50, 33, 47, 46 };
		array[274] = array274;
		int[] array275 = { 113, 46, 51, 45, 59, 56, 41, 50, 45, 48 };
		array[275] = array275;
		int[] array276 = { 125, 60, 48, 51, 58, 52, 33, 39, 39, 51 };
		array[276] = array276;
		int[] array277 = { 108, 47, 56, 44, 44, 37, 63, 45, 58, 56 };
		array[277] = array277;
		int[] array278 = { 102, 47, 54, 44, 42, 54, 57, 49, 51, 61 };
		array[278] = array278;
		int[] array279 = { 122, 44, 56, 51, 52, 33, 53, 43, 59, 50 };
		array[279] = array279;
		int[] array280 = { 115, 46, 54, 48, 59, 50, 47, 53, 42, 52 };
		array[280] = array280;
		int[] array281 = { 109, 53, 28, 59, 46, 63, 53, 51, 47, 59 };
		array[281] = array281;
		int[] array282 = { 111, 51, 48, 48, 52, 47, 52, 52, 60, 50 };
		array[282] = array282;
		int[] array283 = { 109, 44, 45, 59, 58, 48, 60, 41, 62, 47 };
		array[283] = array283;
		int[] array284 = { 120, 52, 58, 47, 64, 46, 37, 49, 46, 57 };
		array[284] = array284;
		int[] array285 = { 135, 43, 42, 56, 47, 42, 46, 55, 58, 54 };
		array[285] = array285;
		int[] array286 = { 126, 43, 60, 40, 43, 53, 55, 64, 49, 47 };
		array[286] = array286;
		int[] array287 = { 116, 52, 53, 45, 47, 55, 43, 64, 49, 59 };
		array[287] = array287;
		int[] array288 = { 116, 54, 50, 56, 49, 51, 59, 51, 53, 46 };
		array[288] = array288;
		int[] array289 = { 117, 44, 51, 59, 49, 55, 57, 48, 59, 49 };
		array[289] = array289;
		int[] array290 = { 124, 59, 51, 49, 54, 48, 49, 49, 51, 56 };
		array[290] = array290;
		int[] array291 = { 116, 64, 41, 56, 57, 53, 65, 43, 49, 49 };
		array[291] = array291;
		int[] array292 = { 127, 51, 48, 52, 52, 42, 53, 53, 51, 66 };
		array[292] = array292;
		int[] array293 = { 120, 57, 63, 49, 44, 56, 47, 49, 43, 70 };
		array[293] = array293;
		int[] array294 = { 125, 55, 46, 58, 53, 52, 56, 51, 64, 40 };
		array[294] = array294;
		int[] array295 = { 105, 55, 59, 55, 53, 53, 51, 44, 70, 58 };
		array[295] = array295;
		int[] array296 = { 122, 57, 47, 46, 54, 50, 54, 52, 66, 57 };
		array[296] = array296;
		int[] array297 = { 132, 55, 53, 60, 49, 46, 45, 54, 47, 67 };
		array[297] = array297;
		int[] array298 = { 125, 70, 43, 53, 59, 57, 48, 47, 49, 59 };
		array[298] = array298;
		int[] array299 = { 123, 59, 56, 51, 51, 56, 45, 57, 64, 51 };
		array[299] = array299;
		int[] array300 = { 121, 42, 66, 54, 53, 59, 66, 54, 51, 49 };
		array[300] = array300;
		int[] array301 = { 128, 57, 57, 57, 54, 59, 57, 53, 45, 50 };
		array[301] = array301;
		int[] array302 = { 124, 55, 51, 63, 54, 46, 47, 55, 73, 52 };
		array[302] = array302;
		int[] array303 = { 115, 62, 60, 50, 59, 62, 44, 62, 55, 53 };
		array[303] = array303;
		int[] array304 = { 142, 51, 59, 48, 58, 52, 64, 54, 46, 51 };
		array[304] = array304;
		int[] array305 = { 131, 44, 60, 59, 54, 48, 54, 66, 53, 58 };
		array[305] = array305;
		int[] array306 = { 130, 70, 59, 50, 44, 53, 57, 57, 53, 57 };
		array[306] = array306;
		int[] array307 = { 123, 52, 66, 67, 56, 59, 52, 56, 51, 50 };
		array[307] = array307;
		int[] array308 = { 133, 60, 57, 72, 60, 50, 43, 50, 48, 62 };
		array[308] = array308;
		int[] array309 = { 142, 64, 55, 55, 56, 62, 44, 50, 56, 53 };
		array[309] = array309;
		int[] array310 = { 117, 60, 58, 54, 42, 51, 81, 67, 60, 50 };
		array[310] = array310;
		int[] array311 = { 136, 59, 51, 59, 54, 52, 60, 50, 57, 64 };
		array[311] = array311;
		int[] array312 = { 136, 64, 59, 50, 40, 47, 70, 71, 51, 57 };
		array[312] = array312;
		int[] array313 = { 129, 58, 60, 65, 70, 53, 52, 58, 52, 50 };
		array[313] = array313;
		int[] array314 = { 134, 57, 60, 57, 48, 54, 62, 63, 57, 58 };
		array[314] = array314;
		int[] array315 = { 125, 64, 71, 59, 56, 50, 60, 56, 52, 59 };
		array[315] = array315;
		int[] array316 = { 134, 46, 57, 54, 80, 57, 55, 54, 60, 58 };
		array[316] = array316;
		int[] array317 = { 129, 59, 67, 59, 63, 53, 56, 62, 64, 45 };
		array[317] = array317;
		int[] array318 = { 136, 58, 54, 58, 55, 60, 54, 67, 60, 58 };
		array[318] = array318;
		int[] array319 = { 128, 59, 75, 60, 47, 67, 73, 48, 48, 57 };
		array[319] = array319;
		int[] array320 = { 133, 48, 59, 62, 63, 63, 63, 51, 61, 62 };
		array[320] = array320;
		int[] array321 = { 138, 63, 49, 57, 64, 65, 66, 57, 52, 56 };
		array[321] = array321;
		int[] array322 = { 128, 55, 54, 58, 60, 53, 66, 60, 74, 62 };
		array[322] = array322;
		int[] array323 = { 141, 57, 66, 54, 62, 61, 54, 66, 52, 59 };
		array[323] = array323;
		int[] array324 = { 142, 80, 61, 62, 44, 52, 51, 56, 55, 72 };
		array[324] = array324;
		int[] array325 = { 139, 46, 67, 65, 63, 49, 68, 71, 58, 51 };
		array[325] = array325;
		int[] array326 = { 140, 58, 56, 55, 59, 64, 75, 52, 67, 54 };
		array[326] = array326;
		int[] array327 = { 155, 50, 56, 74, 53, 46, 60, 59, 78, 51 };
		array[327] = array327;
		int[] array328 = { 140, 55, 67, 66, 49, 72, 62, 53, 57, 64 };
		array[328] = array328;
		int[] array329 = { 145, 55, 65, 61, 48, 70, 55, 59, 60, 69 };
		array[329] = array329;
		int[] array330 = { 154, 58, 53, 54, 71, 76, 55, 64, 58, 47 };
		array[330] = array330;
		int[] array331 = { 133, 53, 64, 70, 69, 62, 64, 65, 52, 60 };
		array[331] = array331;
		int[] array332 = { 144, 61, 48, 62, 62, 54, 62, 66, 66, 70 };
		array[332] = array332;
		int[] array333 = { 137, 53, 63, 56, 71, 70, 61, 51, 66, 70 };
		array[333] = array333;
		int[] array334 = { 135, 70, 53, 59, 59, 67, 71, 62, 65, 59 };
		array[334] = array334;
		int[] array335 = { 150, 63, 54, 62, 57, 73, 53, 62, 73, 56 };
		array[335] = array335;
		int[] array336 = { 137, 69, 48, 59, 65, 58, 71, 60, 73, 65 };
		array[336] = array336;
		int[] array337 = { 159, 52, 59, 61, 63, 63, 58, 63, 62, 68 };
		array[337] = array337;
		int[] array338 = { 142, 63, 66, 54, 57, 50, 67, 72, 67, 72 };
		array[338] = array338;
		int[] array339 = { 155, 69, 54, 58, 54, 65, 71, 63, 58, 66 };
		array[339] = array339;
		int[] array340 = { 147, 75, 65, 74, 59, 53, 57, 49, 83, 53 };
		array[340] = array340;
		int[] array341 = { 137, 62, 55, 66, 58, 71, 74, 67, 61, 67 };
		array[341] = array341;
		int[] array342 = { 155, 56, 61, 72, 59, 68, 63, 59, 69, 58 };
		array[342] = array342;
		int[] array343 = { 144, 63, 70, 59, 75, 64, 60, 75, 58, 55 };
		array[343] = array343;
		int[] array344 = { 150, 66, 66, 77, 56, 56, 69, 50, 68, 67 };
		array[344] = array344;
		int[] array345 = { 160, 53, 60, 62, 57, 80, 55, 66, 78, 57 };
		array[345] = array345;
		int[] array346 = { 144, 77, 65, 68, 67, 72, 57, 70, 53, 57 };
		array[346] = array346;
		int[] array347 = { 159, 59, 65, 68, 73, 60, 67, 61, 59, 62 };
		array[347] = array347;
		int[] array348 = { 149, 60, 62, 61, 67, 68, 74, 66, 72, 57 };
		array[348] = array348;
		int[] array349 = { 147, 80, 62, 61, 64, 61, 62, 56, 83, 62 };
		array[349] = array349;
		int[] array350 = { 143, 73, 59, 67, 76, 71, 61, 62, 60, 69 };
		array[350] = array350;
		int[] array351 = { 158, 65, 65, 71, 74, 65, 60, 62, 68, 55 };
		array[351] = array351;
		int[] array352 = { 147, 58, 61, 56, 65, 69, 85, 59, 67, 79 };
		array[352] = array352;
		int[] array353 = { 166, 72, 69, 64, 59, 74, 67, 49, 61, 67 };
		array[353] = array353;
		int[] array354 = { 163, 60, 63, 67, 81, 70, 66, 52, 57, 72 };
		array[354] = array354;
		int[] array355 = { 153, 54, 74, 65, 71, 55, 70, 65, 76, 70 };
		array[355] = array355;
		int[] array356 = { 158, 60, 63, 67, 89, 71, 66, 60, 60, 62 };
		array[356] = array356;
		int[] array357 = { 172, 57, 65, 58, 70, 68, 65, 78, 63, 62 };
		array[357] = array357;
		int[] array358 = { 162, 66, 64, 76, 61, 74, 71, 50, 66, 71 };
		array[358] = array358;
		int[] array359 = { 150, 73, 72, 58, 71, 52, 77, 68, 73, 70 };
		array[359] = array359;
		int[] array360 = { 166, 55, 62, 75, 73, 73, 65, 65, 70, 62 };
		array[360] = array360;
		int[] array361 = { 157, 62, 71, 80, 69, 72, 66, 71, 65, 56 };
		array[361] = array361;
		int[] array362 = { 161, 67, 72, 57, 72, 69, 66, 77, 60, 70 };
		array[362] = array362;
		int[] array363 = { 155, 65, 83, 77, 58, 57, 73, 75, 61, 70 };
		array[363] = array363;
		int[] array364 = { 158, 69, 61, 74, 74, 74, 59, 70, 69, 68 };
		array[364] = array364;
		int[] array365 = { 166, 76, 54, 64, 72, 69, 69, 60, 70, 79 };
		array[365] = array365;
		int[] array366 = { 160, 93, 58, 60, 74, 81, 58, 64, 59, 74 };
		array[366] = array366;
		
//		  (0)    0    (1)    0    (2)    0    (3)    0    (4)    0
//		  (5)    0    (6)    1    (7)    0    (8)    0    (9)    0
		
		String line = readLn();
		while (!line.equals("0")) {
			int index = Integer.parseInt(line);
			System.out.println(line + "! --");
			
			
			System.out.print(getP(6,0) + get(5, array[index][0]));
			for (int k = 1; k < 5; k++) {
				System.out.print(getP(7, k) + get(5, array[index][k]));
			}
			System.out.println();
			System.out.print(getP(6,5) + get(5, array[index][5]));
			for (int k = 6; k < 10; k++) {
				System.out.print(getP(7, k) + get(5, array[index][k]));
			}
			System.out.println();
			
			line = readLn();
		}
	}


	private static String get(int i, int k) {
		String answer = ""+k;
		for (int j = answer.length(); j < i; j++) {
			answer = " "+ answer;
		}
		return answer;


	}


	private static String getP(int i, int k) {
		String answer = "("+k+")";
		for (int j = answer.length(); j < i; j++) {
			answer = " "+ answer;
		}
		return answer;
	}
}